if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

export ZSH="/home/li/.oh-my-zsh"

plugins=(
	git
	zsh-syntax-highlighting
	zsh-autosuggestions
	colored-man-pages
	extract
)


source $ZSH/oh-my-zsh.sh

. /etc/profile.d/autojump.zsh

[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh


if [ "$(tty)" = "/dev/tty1" ]; then
 export LC_ALL="en_US.UTF-8"
 export LANGUAGE="en_US.UTF-8"
 export LANG="en_US.UTF-8"
fi
if [ "$(tty)" = "/dev/tty2" ]; then
 export LC_ALL="en_US.UTF-8"
 export LANGUAGE="en_US.UTF-8"
 export LANG="en_US.UTF-8"
fi


alias c='clear'
alias ll='ls -lh'
alias lsl='ls -lrt'     # 以列表方式显示目录项
alias la='ll -a'
alias grep="grep --color=auto"
alias -s html=kate   # 在命令行直接输入后缀为 html 的文件名，会在 TextMate 中打开
alias -s md=ty  # 在命令行输入后缀为md的文件会在typora中打开
alias -s rb=kate     # 在命令行直接输入 ruby 文件，会在 TextMate 中打开
alias -s py=nvim       # 在命令行直接输入 python 文件，会用 vim 中打开，以下类似
alias -s js=nvim
alias -s c=nvim
alias -s java=nvim
alias -s txt=nvim
alias -s yaml=nvim

alias jlog='journalctl -f -o short -u'
alias h='history -ir -10'
alias mv='mv -i'
alias x='extract'
alias rename='perl-rename'
alias xp='xmodmap ~/.Xmodmap'
alias ra='ranger'
alias mp='mkdir -p'

# ===
# ===proxy
# ===
alias allProxy="export https_proxy=http://127.0.0.1:8087 http_proxy=http://127.0.0.1:8087 all_proxy=socks4://127.0.0.1:1087"
alias socks="export ALL_PROXY=socks5://127.0.0.1:1087 "
#alias proxy="ALL_PROXY=http://localhost:8087 "
#alias https="export ALL_PROXY=https://127.0.0.1:8087"
alias http="export ALL_PROXY=http://127.0.0.1:8087"
alias proxyyarn="yarn config set proxy socks5://127.0.0.1:1087"
alias proxynpm="npm config set proxy socks5://127.0.0.1:1087"

alias pip3sp="sudo -H pip3 --proxy localhost:1087"
alias pip3p="pip3 --proxy localhost:1087"
alias unproxy='unset ALL_PROXY'

alias pc='proxychains4'
alias pssh='proxychains4 ssh -D 9000 ubuntu@13.127.67.158'


# ===
# === Git
# ===
alias ggn='git config --global user.name "'
alias gge='git config --global user.email'

alias gcl='git config --list'

alias gs='git status'
alias gpm='git commit -m"'
alias gpp='git push -u origin master'
alias gmm='git push -u origin main'
alias gfu='git fetch upstream'
alias gmu='git merge upstream/master'

alias ghp='git config --global http.proxy "localhost:1089"
	git config --global http.proxy'

alias gd='git clone --depth=1 '
alias lg='lazygit'
alias s='cd ~/.ssh/ && ls'
alias grr='git push origin --delete '
alias grl='git branch -D '
# ===
# === vim
# ===

alias v3='nvim /home/$USER/.config/i3/config'
alias vz='nvim /home/li/.zshrc'
alias vn='nvim /home/$USER/.config/nvim/init.vim'
alias vv='nvim /home/$USER/.vimrc'
alias va='nvim /home/$USER/.config/alacritty/alacritty.yml' 
alias vf='nvim /home/$USER/.config/fcitx/rime/flypy_user.txt'
alias vf=nvim /home/$USER/.local/share/fcitx5/rime/flypy_user.txt
alias vf=nvim /home/$USER/.local/share/fcitx5/rime/
alias vf=nvim /home/$USER/.local/share/fcitx5/rime/flypy_user.txt
# ===
# === source
# ===
alias se='source /etc/profile'
alias sz='source /home/$USER/.zshrc'

# xrandr
# 同时打开笔记本和外接显示器(显示器在左侧)
alias screenlefton="xrandr --output DP3 --left-of eDP1"
# 同时打开笔记本和外接显示器(显示器在右侧)
alias screenrighton="xrandr --output DP3 --auto --right-of eDP1"
# 关闭外接显示器，只有笔记本工作
alias onlylap="xrandr --output DP1 --off"
#alias onlylap="sh $HOME/.screenlayout/lap.sh &"
# 关闭笔记本显示器，外接显示器工作
#alias onlyscreen="xrandr --output eDP1 --off --output DP1 --off --output DP2 --off --output DP3 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output VIRTUAL1 --off"
alias onlyscreen="sh $HOME/.screenlayout/onlyscreen.sh &"
# 克隆，外接显示器和笔记本显示同样内容
alias eDP1on="xrandr --output DP1 --same-as eDP1 --auto"
# fortune|lolcat

# ===
# === intel_backlight背光调节(xbacklight)
# ===
alias backlighton='sudo chmod o+w /sys/class/backlight/intel_backlight/brightness'
alias xl5='xbacklight -set 50'
alias xl2='xbacklight -set 20'
alias xl0='xbacklight -set 100'
alias xli='xbacklight -inc 10'
alias xld='xbacklight -dec 10'
alias actb='cat /sys/class/backlight/intel_backlight/actual_brightness'
alias maxb='cat /sys/class/backlight/intel_backlight/max_brightness'

# mariadb
alias ma='mysql -u root -p'
alias mo='systemctl start mysqld.service'
alias mf='systemctl stop mysqld.service'
alias ms='systemctl status mysqld.service'

# systemctl
alias sl='systemctl list-units --type service | less'

# ===
# === web
# ===
#Tomcat
alias tom='/opt/web/tomcat/apache-tomcat-9.0.29/bin/startup.sh'
alias mot='/opt/web/tomcat/apache-tomcat-9.0.29/bin/shutdown.sh'

# ===
# === tmux
# ===
alias tl='tmux ls'
alias tn='tmux new -s'
alias ta='tmux attach -t'
alias tk='tmux kill-session -t'
alias tf='tmux kill-session'
alias ts='tmux switch -t'
alias tr='tmux rename-session -t'


# ===
# === code
# ===
alias code='/usr/bin/code'
#source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme

# ===
# === cool
# ===
# 终端中看天气
alias weather='curl wttr.in/chengdu'

alias p='pfetch'

alias b='bpytop'
alias v='nvim'
alias k='kubectl'

# ===
# === polybar
# ===
alias lightbar='/bin/bash $HOME/.config/polybar/launch.sh light'
alias darkbar='/bin/bash $HOME/.config/polybar/launch.sh dark'

# ===
# === Code
# ===

alias cg='cd $HOME/Code/go/'
alias cj='cd $HOME/Code/java/'
alias ct='cd $HOME/Code/train/'
alias m='cd /home/li/go/src/mimir'
alias basic='cd $HOME/Code/go/basic/ && ls'

# ===
# === dotfiles
# ===
alias dot='cd $HOME/.dotfiles'
alias ld='ls -ail $HOME/.dotfiles'


# ===
# === linux tools
# ===
alias td='pc tldr '
alias ld='ls -ail $HOME/.dotfiles'

#############################################################################
#                                   bspwm java                                      #
#############################################################################

export _JAVA_AWT_WM_NONREPARENTING=1

source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme


